import { createRouter, createWebHashHistory } from 'vue-router'
import Home from '@/views/Home'
import Layout from '@/views/Layout'
import Play from '@/components'// 导入自定义组件

const TopCategory = () => import('@/views/Category/index.vue')
const SubCategory = () => import('@/views/Category/sub.vue')
// 创建路由实例
const routes = [
  {
    path: '/',
    component: Layout,
    children: [
      {
        path: '/',
        component: Home
      }, {
        path: '/category/:id',
        component: TopCategory
      }, {
        path: '/SubCategory/:id',
        component: SubCategory
      }
    ]
  },
  {
    path: '/play',
    component: Play
  }
  // 面包屑路由

]

const router = createRouter({
  // 使用hash方式实现路由
  // 配置路由规则
  history: createWebHashHistory(),
  routes
})

export default router
